package homework.work3;

import java.util.Locale;

public class Main {
    public static void main(String[] args) {
        String s="peter piper picked a peck of pickled peppers";
        String[] s1 = s.split(" ");
        int count=0;
        for (String str : s1) {
/*            if('p'==str.charAt(0)){
                count++;
            }*/
            //多用新学的方法
            if (str.startsWith("p")){
                count++;
            }
        }
        System.out.println(count);


    }
}
